﻿using EasyLucky.Dal.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyLucky.Dal.Dal
{
    public class LuckyDal:BaseDal
    {
        public List<LuckyEntity> QueryAll()
        {
            var db = GetClient();
            var Luckys = db.Queryable<LuckyEntity>().ToList();
            return Luckys;
        }

        public int AddLucky(LuckyEntity Lucky)
        {
            var db = GetClient();
            int id = db.Insertable<LuckyEntity>(Lucky).ExecuteReturnIdentity();
            return id;
        }

        public int DeleteLucky(LuckyEntity Lucky)
        {
            var db = GetClient();
            int cnt = db.Deleteable<LuckyEntity>(Lucky.Id).ExecuteCommand();
            return cnt;
        }

        public int UpdateLucky(LuckyEntity Lucky)
        {
            var db = GetClient();
            int cnt = db.Updateable<LuckyEntity>(Lucky).ExecuteCommand();
            return cnt;
        }
    }
}
